<template>
  <div class="home">
    <!-- 悬浮时钟 -->
    <div class="floating-clock">
      <div class="time">{{ time }}</div>
      <div class="date">{{ date }}</div>
    </div>

    <!-- Header Section -->
    <header class="header">
      <div class="header-content">
        <h1>洛页工具箱</h1>
        <p class="subtitle">点击左侧按钮探索更多惊喜吧！</p>
        <div class="header-links">
          <router-link to="/about" class="header-link">关于我们</router-link>
          <router-link to="/contact" class="header-link">联系我们</router-link>
        </div>
      </div>
    </header>

    <!-- Navigation Section -->
    <nav class="navbar">
      <ul>
        <li><router-link to="/supportAudio" class="nav-link">洛页云音乐</router-link></li>
        <li><router-link to="/calendar" class="nav-link">日历</router-link></li>
        <li><router-link to="/weather" class="nav-link">天气查询</router-link></li>
        <li><router-link to="/note" class="nav-link">笔记</router-link></li>
        <li><router-link to="/wallpaper" class="nav-link">4k壁纸</router-link></li>
        <li><router-link to="/system" class="nav-link">系统工具</router-link></li>
      </ul>
    </nav>

    <!-- Main Content Section -->
    <main class="content">
      <div class="content-card">
        <h2>探索我们的工具</h2>
        <p class="content-text">为您提供高效便捷的在线工具集合，提升工作效率。</p>
        <button class="cta-button" @click="showAlert">立即体验</button>
      </div>
    </main>

    <!-- Footer Section -->
    <footer class="footer">
      <div class="footer-content">
        <p>&copy; 2025 洛页云 | 让科技更简单</p>
      </div>
    </footer>
  </div>
</template>

<script>
export default {
  data() {
    return {
      time: '',
      date: ''
    }
  },
  mounted() {
    this.updateClock()
    setInterval(this.updateClock, 1000)
  },
  name: 'Home',
  methods: {
    showAlert() {
      alert('欢迎使用洛页工具箱！');
    },
    updateClock() {
      const now = new Date()
      // 格式化时间 HH:MM:SS
      this.time = now.toLocaleTimeString()
      // 格式化日期 YYYY年MM月DD日 星期X
      const options = { year: 'numeric', month: 'long', day: 'numeric', weekday: 'long' }
      this.date = now.toLocaleDateString('zh-CN', options)
    }
  }
}
</script>

<style scoped>
.home {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #f8f9fa;
  color: #333;
}

/* 悬浮时钟样式 */
.floating-clock {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 15px 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  z-index: 100;
  text-align: center;
}

.floating-clock .time {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2d66b1;
}

.floating-clock .date {
  font-size: 0.9rem;
  color: #666;
  margin-top: 5px;
}

/* 头部样式 */
.header {
  background: linear-gradient(135deg, #2d66b1 0%, #3a7bd5 100%);
  color: white;
  padding: 60px 20px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.header h1 {
  font-size: 2.5rem;
  margin: 0;
  font-weight: 700;
}

.header .subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-top: 10px;
}

/* 头部链接样式 */
.header-links {
  position: absolute;
  bottom: 2px;
  right: 20px;
  display: flex;
  gap: 15px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 15px;
  border-radius: 20px;
  backdrop-filter: blur(5px);
}

.header-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
  padding: 5px 0;
  position: relative;
}

.header-link:hover {
  color: white;
}

.header-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: white;
  transition: width 0.3s ease;
}

.header-link:hover::after {
  width: 100%;
}

.router-link-exact-active.header-link {
  color: white;
  font-weight: 500;
}

/* 导航栏样式 */
.navbar {
  background-color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 90;
}

.navbar ul {
  list-style-type: none;
  margin: 0 auto;
  padding: 0;
  display: flex;
  justify-content: center;
  max-width: 1200px;
}

.navbar li {
  margin: 0;
}

.nav-link {
  display: block;
  color: #444;
  padding: 18px 25px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

.nav-link:hover {
  color: #2d66b1;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: #2d66b1;
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 50%;
}

.router-link-exact-active {
  color: #2d66b1;
}

.router-link-exact-active::after {
  width: 50% !important;
}

/* 内容区域样式 */
.content {
  flex: 1;
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.content-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.content h2 {
  font-size: 2rem;
  color: #2d66b1;
  margin-bottom: 20px;
}

.content-text {
  font-size: 1.1rem;
  line-height: 1.6;
  color: #555;
  margin-bottom: 30px;
}

/* CTA按钮样式 */
.cta-button {
  background: linear-gradient(135deg, #2d66b1 0%, #3a7bd5 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  font-size: 1rem;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(45, 102, 177, 0.3);
  font-weight: 500;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 102, 177, 0.4);
}

.cta-button:active {
  transform: translateY(0);
}

/* 页脚样式 */
.footer {
  background: #2d3748;
  color: rgba(255, 255, 255, 0.8);
  padding: 25px 20px;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer p {
  margin: 0;
  font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }

  .header .subtitle {
    font-size: 1rem;
  }

  .navbar ul {
    flex-direction: column;
  }

  .navbar li {
    margin: 0;
  }

  .nav-link {
    padding: 15px;
  }

  .content-card {
    padding: 30px 20px;
  }

  .floating-clock {
    top: 10px;
    right: 10px;
    padding: 10px 15px;
  }

  .floating-clock .time {
    font-size: 1.2rem;
  }
}
</style>